package com.kashi.controller;

import com.kashi.pojo.Result;
import com.kashi.pojo.Slider;
import com.kashi.service.SliderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api")
public class SliderController {

    @Autowired
    private SliderService sliderService;

    //获取轮播图列表
    @GetMapping("/slider")
    public Result getSlider(){
        log.info("获取轮播图列表");
        //调用service获取
        List<Slider> sliderList=sliderService.list();
        return Result.success(sliderList);
    }

}
